# ~*~ coding: utf-8 ~*~


class ErrorFormMinx:

    def get_error(self):
        errors = self.errors
        try:
            errors.update(self.global_error)
        except AttributeError:
            pass

        error_data = {}
        for field, message in errors.items():
            error_data['field'] = field
            error_data['message'] = message[0]
            break
        print('error_data--->{}'.format(error_data))
        return error_data

    def update_error(self, error):
        self.global_error = self.errors
        self.global_error.update(error)

    class Meta:
        locales = ['zh']
